home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / parted / debug.h < prev    next >
C/C++ Source or Header  |  2006-04-20  |  2KB  |  70 lines

  1. /*
  2.     libparted - a library for manipulating disk partitions
  3.     Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  18. */
  19.  
  20. #ifndef PED_DEBUG_H_INCLUDED
  21. #define PED_DEBUG_H_INCLUDED
  22.  
  23. #include "config.h"
  24.  
  25. #ifdef DEBUG
  26.  
  27. extern int
  28. ped_assert (int cond, const char* cond_text,
  29.         const char* file, int line, const char* function);
  30.  
  31. #ifdef __GNUC__
  32.  
  33. #define PED_ASSERT(cond, action)                \
  34.     do {                            \
  35.     if (!ped_assert (cond,                    \
  36.              #cond,                    \
  37.              __FILE__,                \
  38.              __LINE__,                \
  39.              __PRETTY_FUNCTION__))            \
  40.     {                            \
  41.         action;                        \
  42.     }                            \
  43.     } while (0)
  44.  
  45. #else /* !__GNUC__ */
  46.  
  47. #define PED_ASSERT(cond, action)                \
  48.     do {                            \
  49.     if (!ped_assert (cond,                    \
  50.              #cond,                    \
  51.              "unknown",                \
  52.              0,                    \
  53.              "unknown"))                \
  54.     {                            \
  55.         action;                        \
  56.     }                            \
  57.     } while (0)
  58.  
  59.  
  60. #endif /* __GNUC__ */
  61.  
  62. #else /* !DEBUG */
  63.  
  64. #define PED_ASSERT(cond, action)    while (0) {}
  65.  
  66. #endif /* DEBUG */
  67.  
  68. #endif /* PED_DEBUG_H_INCLUDED */
  69.  
  70.